package dry.example.disruptor;

import com.alibaba.fastjson.JSONObject;
import lombok.Data;

/**
 * 消息
 *
 * @author zc
 */
@Data
public class Message {

    private String cmd;

    private String deviceUnique;

    private Long timestamp;

    public Message() {
    }

    public Message(String cmd, String deviceUnique, Long timestamp) {
        this.cmd = cmd;
        this.deviceUnique = deviceUnique;
        this.timestamp = timestamp;
    }

    @Override
    public String toString() {
        JSONObject json = new JSONObject();
        json.put("cmd", cmd);
        json.put("deviceUnique", deviceUnique);
        json.put("timestamp", timestamp);
        return JSONObject.toJSONString(json);
    }

}
